package schemax

//
//import (
//	"reflect"
//	"unsafe"
//)
//
//func (decl *ClassDecl) UnsafeSetByField(st unsafe.Pointer, name string, val interface{}) (r interface{}) {
//	field, has := decl.GetField(name)
//	if has == false {
//		return nil
//	}
//	decl.UnsafeSet(st, field.Unsafe, val)
//	return
//}
//func (decl *ClassDecl) UnsafeSet(st unsafe.Pointer, info UnsafeInfo, val interface{}) (r interface{}) {
//	unsafeval := unsafe.Pointer(uintptr(st) + info.Offset)
//	switch info.Kind {
//	case reflect.Map:
//		prop := (*map[string]interface{})(unsafeval)
//		if val == nil {
//			*prop = nil
//		} else {
//			*prop = val.(map[string]interface{})
//		}
//	case reflect.Slice:
//		fallthrough
//	case reflect.Array:
//		prop := (*[]interface{})(unsafeval)
//		if val == nil {
//			*prop = nil
//		} else {
//			*prop = val.([]interface{})
//		}
//	case reflect.Bool:
//		prop := (*bool)(unsafeval)
//		*prop = val.(bool)
//	case reflect.String:
//		prop := (*string)(unsafeval)
//		*prop = val.(string)
//	case reflect.Int:
//		prop := (*int)(unsafeval)
//		*prop = val.(int)
//	case reflect.Int8:
//		prop := (*int8)(unsafeval)
//		*prop = val.(int8)
//	case reflect.Int16:
//		prop := (*int16)(unsafeval)
//		*prop = val.(int16)
//	case reflect.Int32:
//		prop := (*int32)(unsafeval)
//		*prop = val.(int32)
//	case reflect.Int64:
//		prop := (*int64)(unsafeval)
//		*prop = val.(int64)
//	case reflect.Uint:
//		prop := (*uint)(unsafeval)
//		*prop = val.(uint)
//	case reflect.Uint8:
//		prop := (*uint8)(unsafeval)
//		*prop = val.(uint8)
//	case reflect.Uint16:
//		prop := (*uint16)(unsafeval)
//		*prop = val.(uint16)
//	case reflect.Uint32:
//		prop := (*uint32)(unsafeval)
//		*prop = val.(uint32)
//	case reflect.Uint64:
//		prop := (*uint64)(unsafeval)
//		*prop = val.(uint64)
//	case reflect.Float32:
//		prop := (*float32)(unsafeval)
//		*prop = val.(float32)
//	case reflect.Float64:
//		prop := (*float64)(unsafeval)
//		*prop = val.(float64)
//	}
//
//	return
//}
//
//func (decl *ClassDecl) UnsafeGetByField(st unsafe.Pointer, name string) (r interface{}) {
//	field, has := decl.GetField(name)
//	if has == false {
//		return nil
//	}
//	decl.UnsafeGet(st, field.Unsafe)
//	return
//}
//
//func (decl *ClassDecl) UnsafeIsNil(st unsafe.Pointer) bool {
//	st = unsafe.Pointer(uintptr(*(*uint)(st)))
//	return unsafe.Sizeof(st) == 0
//}
//
//func (decl *ClassDecl) UnsafeGetPointer(st unsafe.Pointer, info UnsafeInfo) (r unsafe.Pointer) {
//	return unsafe.Pointer(uintptr(st) + info.Offset)
//}
//
//func (decl *ClassDecl) UnsafeGet(st unsafe.Pointer, info UnsafeInfo) (r interface{}) {
//	unsafeval := unsafe.Pointer(uintptr(st) + info.Offset)
//	switch info.Kind {
//	case reflect.Map:
//		val := (*interface{})(unsafeval)
//		r = *val
//	case reflect.Slice:
//		fallthrough
//	case reflect.Array:
//		val := (*interface{})(unsafeval)
//		r = *val
//	case reflect.Bool:
//		val := (*bool)(unsafeval)
//		r = *val
//	case reflect.String:
//		val := (*string)(unsafeval)
//		r = *val
//	case reflect.Int:
//		val := (*int)(unsafeval)
//		r = *val
//	case reflect.Int8:
//		val := (*int8)(unsafeval)
//		r = *val
//	case reflect.Int16:
//		val := (*int16)(unsafeval)
//		r = *val
//	case reflect.Int32:
//		val := (*int32)(unsafeval)
//		r = *val
//	case reflect.Int64:
//		val := (*int64)(unsafeval)
//		r = *val
//	case reflect.Uint:
//		val := (*uint)(unsafeval)
//		r = *val
//	case reflect.Uint8:
//		val := (*uint8)(unsafeval)
//		r = *val
//	case reflect.Uint16:
//		val := (*uint16)(unsafeval)
//		r = *val
//	case reflect.Uint32:
//		val := (*uint32)(unsafeval)
//		r = *val
//	case reflect.Uint64:
//		val := (*uint64)(unsafeval)
//		r = *val
//	case reflect.Float32:
//		val := (*float32)(unsafeval)
//		r = *val
//	case reflect.Float64:
//		val := (*float64)(unsafeval)
//		r = *val
//	}
//
//	return
//}
